package se.webbzon.boltzmann.object.geometry;

import se.webbzon.oschi01.collision3d.CollisionCone3D;
import se.webbzon.oschi01.collision3d.CollisionCube3D;
import se.webbzon.oschi01.collision3d.CollisionCylinder3D;
import se.webbzon.oschi01.collision3d.CollisionEllipsoid3D;
import se.webbzon.oschi01.collision3d.CollisionFloor3D;
import se.webbzon.oschi01.collision3d.CollisionNode3D;
import se.webbzon.oschi01.collision3d.CollisionWall3D;
import se.webbzon.oschi01.collision3d.CollisionXYPlane3D;
import se.webbzon.oschi01.collision3d.CollisionXZPlane3D;
import se.webbzon.oschi01.collision3d.CollisionYZPlane3D;

public class GeometryMask {
	
	// The geometry used for this geometry mask
	private final GeometryEnum geometry;
	
	// Whatever the surface of the geometry is closed or not
	private boolean open;
		
	// The number of divisions used for this geometry
	private int divisions;
	
	// The 3d-collision model associated with this geometry mask
	private final CollisionNode3D mask;
		
	/*============================================================
	Constructors
	============================================================*/
	
	public GeometryMask(GeometryEnum geometry, boolean open, int divisions) {
		this.geometry = geometry;
		this.open = open;
		this.divisions = divisions;
		switch (geometry) {
		case CONE:
			mask = new CollisionCone3D(open,divisions);
			break;
		case CUBE:
			mask = new CollisionCube3D();
			break;
		case CYLINDER:
			mask = new CollisionCylinder3D(open,divisions);
			break;
		case ELLIPSOID:
			mask = new CollisionEllipsoid3D(divisions);
			break;
		case FLOOR:
			mask = new CollisionFloor3D();
			break;
		case WALL:
			mask = new CollisionWall3D();
			break;
		case XYPLANE:
			mask = new CollisionXYPlane3D();
			break;
		case XZPLANE:
			mask = new CollisionXZPlane3D();
			break;
		case YZPLANE:
			mask = new CollisionYZPlane3D();
			break;
		default:
			mask = new CollisionXYPlane3D();
		}
	}
	
	/*============================================================
	Public Methods
	============================================================*/
	
	/** Returns the 3d-collision node associated with this geometry mask. **/
	public CollisionNode3D getMask() {
		return mask;
	}
	
	/** Returns the geometry used for this geometry mask. **/
	public GeometryEnum getGeometry() {
		return geometry;
	}
	
	/** Returns whatever the surface of the geometry is closed or not. **/
	public boolean isOpen() {
		return open;
	}

	/** Returns the number of divisions used for this geometry. **/
	public int getDivisions() {
		return divisions;
	}

}
